﻿using System;
using System.Collections.Generic;
using System.Text;

namespace Barbar.Colonization.Model {
  public class Tile : IUnitLocation {
    private Coordinate m_Coordinate;
    private ITileType m_TileType;
    private List<Unit> m_Units = new List<Unit>();
    private IBonusResourceType m_BonusResourceType;
    private City m_City;

    internal Tile(Coordinate coordinate, ITileType tileType) {
      m_Coordinate = coordinate;
      m_TileType = tileType;
    }

    public Coordinate Coordinate {
      get { return m_Coordinate; }
    }

    public ITileType TileType {
      get { return m_TileType; }
      set { m_TileType = value; }
    }

    public IBonusResourceType BonusResourceType {
      get { return m_BonusResourceType; }
      protected set { m_BonusResourceType = value; }
    }

    public City City {
      get { return m_City; }
      protected set { m_City = value; }
    }

    public Race Owner {
      get {
        if (m_City == null)
          return null;
        return m_City.Race;
      }
    }

    #region IUnitLocation Members

    void IUnitLocation.PlaceNewUnit(Unit unit) {
      m_Units.Add(unit);
    }

    #endregion
  }
}
